package com.cloud.pole.msg.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import com.cloud.pole.msg.biz.SmsTemplateBiz;
import com.cloud.pole.msg.model.entity.SmsTemplate;
import com.cloud.pole.msg.model.entity.SmsTemplateAdmin;
import com.cloud.pole.msg.service.SmsTemplateService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Service(value = "smsTemplateService")
@EnableTransactionManagement
public class SmsTemplateServiceImpl implements SmsTemplateService {

	@Autowired
	private SmsTemplateBiz smsTemplateBiz;
	
	@Override
	public void updateSmsTemplate(SmsTemplate entity) {
		smsTemplateBiz.updateSelectiveById(entity);
	}

	@Override
	public SmsTemplate selectSysSmsSendHisById(int id) {
		return smsTemplateBiz.selectById(id);
	}

	@Override
	public PageInfo<SmsTemplateAdmin> selectPageSmsTemplateAdminList(Map<String, Object> map, int pageNo, int pageSize) {
		PageHelper.startPage(pageNo, pageSize); 
    	List<SmsTemplateAdmin> list = smsTemplateBiz.selectPageSmsTemplateAdminList(map);
    	PageInfo<SmsTemplateAdmin> page = new PageInfo<SmsTemplateAdmin>(list);
    	return page;
	}

	@Override
	public List<SmsTemplate> selectAllList(Map<String, Object> map) {
		return smsTemplateBiz.selectAllList(map);
	}

}
